# Contributor: Dennis Brendel  <buddabrod@gmail.com>

pkgname=mplayer-svn
pkgver=29219
pkgrel=1
pkgdesc="A movie player for linux"
arch=('i686' 'x86_64')
depends=('libxxf86dga' 'libxv' 'libmad' 'giflib' 'cdparanoia' 'gtk2'
         'sdl' 'lame' 'libtheora' 'xvidcore' 'zlib' 'libmng' 'libxss'
         'libgl' 'smbclient' 'aalib' 'jack-audio-connection-kit'
         'x264>=20090108' 'faac' 'lirc-utils' 'ttf-dejavu' 'fribidi')
license=('GPL')
url="http://www.mplayerhq.hu/"
makedepends=('libcaca' 'unzip' 'live-media' 'libdca' 'mesa' 'subversion')
backup=('etc/mplayer/codecs.conf' 'etc/mplayer/input.conf')
conflicts=('mplayer')
provides=('mplayer')
source=(http://www.mplayerhq.hu/MPlayer/skins/Blue-1.7.tar.bz2
	no_segfault_configure.patch)

_svntrunk=svn://svn.mplayerhq.hu/mplayer/trunk
_svnmod=mplayer

build() {

  cd $srcdir

  if [ -d $_svnmod/.svn ]; then
    (cd $_svnmod && svn up -r $pkgver)
  else
    svn co $_svntrunk --config-dir ./ $_svnmod
  fi

  msg "SVN checkout done or server timeout"
  msg "Starting make..."

  cp -r $_svnmod $_svnmod-build
  cd $_svnmod-build

  unset CFLAGS

  patch -p1 -i ${srcdir}/no_segfault_configure.patch || return 1

	./configure --prefix=/usr --enable-gui --disable-arts --enable-x11 \
		--enable-runtime-cpudetection --confdir=/etc/mplayer --disable-nas \
		--enable-gl --enable-tv-v4l1 --enable-tv-v4l2 --enable-largefiles \
		--disable-liblzo --disable-speex --disable-openal \
		--enable-fribidi --disable-libdv --disable-musepack \
		--language=all --disable-dvdnav --disable-esd --disable-mga \
		--disable-libamr_nb --disable-lirc \
		--enable-freetype || return 1

  [ "$CARCH" = "i686" ] &&  sed 's|-march=i486|-march=i686|g' -i config.mak

  make || return 1
  make -j1 DESTDIR=${pkgdir} install || return 1
  cp etc/{codecs.conf,input.conf,example.conf} ${pkgdir}/etc/mplayer/
  ln -s /usr/share/fonts/TTF/DejaVuSans.ttf ${pkgdir}/usr/share/mplayer/subfont.ttf
  rm -rf ${pkgdir}/usr/share/mplayer/font
  mv ${srcdir}/Blue ${pkgdir}/usr/share/mplayer/skins/default

  rm -rf $srcdir/$_svnmod-build
}
md5sums=('e4e2020d11b681aac898103b3ba723c4'
         'ed962f7642ffcf2411ec6465fdc8c132')
